import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    isLoading: false, // 新增加载状态
    //表示Map地图的的集合对象 包括projectLayer等等
    Map: null,
    geom: null,
    area: null,
    circle: null,
    drawpoints: [], //绘制点集合
    projectLayer: null,
    pipProjectLayer: null, //Pip项目图层
    showValveOperate: false, //是否显示阀门操作
    showSaveAnalysis: false, //是否显示阀门操作
    showCutArea: false, //是否显示裁剪区域 
    showMakePic: false,  //是否显示制作图片s
    isUserEquipShow: false, //是否显示用户设备
    userInfo: {
      username: ""
    },
    detailDataPopList: [],
    layersAttribute: [],
    coordinate: {
      X: "",
      Y: "",
    },
    planForm:{},
    dmGetFeature: null,
    dmGetBuffer: null,
    dmGetPipData: null,
    isUserDeviceShow: false,
    isUserDeviceSonShow: false,
    treeDefault: [],
    mapLegendShow: false,
    impactValveList: [],
    impactUserList:[],
    userDetailVisible: false,
    clickPoint: null,
    clickValvePoint: null,
    waterKeyWords:null,
    clickValvePoint2: null,
    secondAnalysisPoint: null,
    pipeAnalysisLine: null,
    isToolShow: true,
    isPositionShow: true,
    isEquipShow: true,
    isAdminShow: true,
    isPipeShow: true,
    clickQueryDataPoint:[],
    clickQueryDataLine:[],
    isInfoPopShow1:false,
    isInfoPopShow2:false,
  },
  getters: {
    clickPoint(state) {
      return state.clickPoint;
    },
    clickValvePoint(state) {
      return state.clickValvePoint;
    },
    clickValvePoint2(state) {
      return state.clickValvePoint2;
    },
    secondAnalysisPoint(state) {
      return state.secondAnalysisPoint;
    },
    pipeAnalysisLine(state) {
      return state.pipeAnalysisLine;
    },
    isUserDeviceSonShow(state) {
      return state.isUserDeviceSonShow;
    },
    showValveOperate(state) {
      return state.showValveOperate;
    },
    showSaveAnalysis(state) {
      return state.showSaveAnalysis;
    },
    isUserDeviceShow(state) {
      return state.isUserDeviceShow;
    },
    dmGetFeature(state) {
      return state.dmGetFeature;
    },
    dmGetBuffer(state) {
      return state.dmGetBuffer;
    },
    Map(state) {
      return state.Map;
    },
    drawpoints(state) {
      return state.drawpoints;
    },
    userInfo(state) {
      return state.userInfo;
    },
    projectLayer(state) {
      return state.projectLayer;
    },
    pipProjectLayer(state) {
      return state.pipProjectLayer;
    },
    coordinate(state) {
      return state.coordinate;
    },
    isLoading(state){
      return state.isLoading;
    }

  },
  mutations: {
    setPlanForm(state, data) {
      state.planForm = data;
    },
    setUserDetailVisible(state, data) {
      state.userDetailVisible = data;
    },
    setIsInfoPopShow1(state, data) {
      state.isInfoPopShow1 = data;
    },
    setIsInfoPopShow2(state, data) {
      state.isInfoPopShow2 = data;
    },
    setClickQueryDataPoint(state, data) {
      state.clickQueryDataPoint = data;
    },
    setClickQueryDataLine(state, data) {
      state.clickQueryDataLine = data;
    },
    setIsLoading(state, isLoading) {
      return state.isLoading = isLoading; // 设置加载状态
    },
    setisToolShow(state, isToolShow) {
      return state.isToolShow = isToolShow;
    },
    setisPositionShow(state, isPositionShow) {
      return state.isPositionShow = isPositionShow;
    },
    setisAdminShow(state, isAdminShow) {
      return state.isAdminShow = isAdminShow;
    },
    setisPipeShow(state, isPipeShow) {
      return state.isPipeShow = isPipeShow;
    },
    setisEquipShow(state, isEquipShow) {
      return state.isEquipShow = isEquipShow;
    },
    setImpactValveList(state, impactValveList) {
      state.impactValveList = impactValveList;
    },
    
    setImpactUserList(state, impactUserList) {
      state.impactUserList = impactUserList;
    },
    setSecondAnalysisPoint(state, secondAnalysisPoint) {
      state.secondAnalysisPoint = secondAnalysisPoint;
    },
    setClickValvePoint(state, clickValvePoint) {
      state.clickValvePoint = clickValvePoint;
    },
    setWaterKeyWords(state, waterKeyWords) {
      state.waterKeyWords = waterKeyWords;
    },
    setClickValvePoint2(state, clickValvePoint2) {
      state.clickValvePoint2 = clickValvePoint2;
    },
    setPipeAnalysisLine(state, pipeAnalysisLine) {
      state.pipeAnalysisLine = pipeAnalysisLine;
    },
    setClickPoint(state, clickPoint) {
      state.clickPoint = clickPoint;
    },
    setMapLegendShow(state, mapLegendShow) {
      state.mapLegendShow = mapLegendShow;
    },
    addTreeDefault(state, treeDefault) {
      state.treeDefault.push(treeDefault);
    },
    delTreeDefault(state, treeDefault) {
      state.treeDefault = state.treeDefault.filter(item => item !== treeDefault);
    },
    setDmGetPipData(state, dmGetPipData) {
      state.dmGetPipData = dmGetPipData;
    },
    setIsUserDeviceSonShow(state, isUserDeviceSonShow) {
      state.isUserDeviceSonShow = isUserDeviceSonShow;
    },
    setisUserDeviceShow(state, isUserDeviceShow) {
      state.isUserDeviceShow = isUserDeviceShow;
    },
    setshowValveOperate(state, showValveOperate) {
      state.showValveOperate = showValveOperate;
    },
    setShowSaveAnalysis(state, showSaveAnalysis) {
      state.showSaveAnalysis =showSaveAnalysis;
    },
    setDmGetBuffer(state, dmGetBuffer) {
      state.dmGetBuffer = dmGetBuffer;
      // 将传入的dmGetBuffer值赋给state对象的dmGetBuffer属性
    },
    setDmGetFeature(state, dmGetFeature) {
      state.dmGetFeature = dmGetFeature;
    },
    setCoordinate(state, coordinate) {
      state.coordinate = coordinate;
    },
    setDrawpoints(state, drawpoints) {
      state.drawpoints = drawpoints;
    },
    setLayersAttribute(state, data) {
      state.layersAttribute = data;
    },
    setDetailDataPopList(state, data) {
      state.detailDataPopList = data;
    },
    setIsUserEquipShow(state, isUserEquipShow) {
      state.isUserEquipShow = isUserEquipShow;
    },
    setUserInfo(state, userInfo) {
      state.userInfo = userInfo != null ? userInfo : null;
    },
    setMap(state, Map) {
      state.Map = Map != null ? Map : null;
    },
    setProjectLayer(state, projectLayer) {
      state.projectLayer = projectLayer != null ? projectLayer : null;
    },
    setPipProjectLayer(state, pipProjectLayer) {
      state.pipProjectLayer = pipProjectLayer != null ? pipProjectLayer : null;
    },
    setGeom(state, data) {
      state.geom = data;
    },
    setArea(state, data) {
      state.area = data;
    },
    setCircle(state, data) {
      state.circle = data;
    },

    setShowCutArea(state, value) {
      state.showCutArea = value;
    },
    setShowMakePic(state, value) {
      state.showMakePic = value;
    },
    clickPoint(state, value) {
      state.clickPoint = value;
    },
    clickValvePoint(state, value) {
      state.clickValvePoint = value;
    },
    clickValvePoint2(state, value) {
      state.clickValvePoint2 = value;
    },
    secondAnalysisPoint(state, value) {
      state.secondAnalysisPoint = value;
    },
    pipeAnalysisLine(state, value) {
      state.pipeAnalysisLine = value;
    },
  },
  actions: {
  },
  modules: {
  }
})
